package com.yc.navy.springmvc.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.yc.navy.springmvc.bean.CartInfo;
import com.yc.navy.springmvc.dto.CartInfoDTO;
import com.yc.navy.springmvc.mapper.ICartInfoMapper;
import com.yc.navy.springmvc.service.ICartInfoService;
import com.yc.navy.springmvc.util.StringUtil;
@Service
public class CartInfoServiceImpl implements ICartInfoService{
	@Autowired
	private ICartInfoMapper cartInfoMapper;
	@Override
	public int add(CartInfo cf) {
		if(StringUtil.checkNull(cf.getCno(), cf.getPno(), cf.getNum())) {
			return -100;
		}
		return cartInfoMapper.add(cf);
	}

	@Override
	public int update(CartInfo cf) {
		if(StringUtil.checkNull(cf.getCno(), cf.getNum())) {
			return -100;
		}
		return cartInfoMapper.update(cf);
	}

	@Override
	public List<CartInfoDTO> finds(String[] cno) {
		return cartInfoMapper.finds(cno);
	}

	@Override
	public int delete(String[] cnos) {
		return cartInfoMapper.delete(cnos);
	}

	@Override
	public int deleteOne(String cno) {
		return cartInfoMapper.deleteOne(cno);
	}

	@Override
	public List<CartInfo> list(Integer mno) {
		return cartInfoMapper.list(mno);
	}

	@Override
	public List<CartInfoDTO> findAll(Integer mno) {
		return cartInfoMapper.findAll(mno);
	}

}
